public class HF_ClientWSContactaddr{   
  @future (callout=true)
  public static void AddContactAddress(set<Id> addset) {
      string outputresult;
      List<Contact_Address__c> addList = new List<Contact_Address__c>([select Id,Name_Id__c,Preferred_Flag__c,Contact_PIMS_Id__c,Address_Type_Code__c,County_Name__c,Preferred__c,State_Name__c,Country_Name__c,City__c,Street__c,Address_Line1__c,Address_Line2__c,Zipcode__c,Zipcode_Extn__c,Comments__c,StatusCode__c from Contact_Address__c where ID In: addset]); 
      WebServiceFinal4.BasicEndpoint s = new WebServiceFinal4.BasicEndpoint();
        for(Contact_Address__c add: addList){
        
        //Stores address details in AddressWrapper
        WebServiceFinal2.AddressWrapper c=new WebServiceFinal2.AddressWrapper();
        c.AddressLine1=add.Address_Line1__c;
        c.AddressLine2=add.Address_Line2__c;
        c.AddressType=add.Address_Type_Code__c;
        c.City=add.City__c;
        c.Comments=add.Comments__c;
        c.Country=add.Country_Name__c;
        c.County=add.County_Name__c;
        c.DataOn=system.DateTime.Now();
        if(add.Name_Id__c!=null){
        c.NameID=Integer.Valueof(add.Name_Id__c); }  
        c.PartnerContactID=add.Contact_PIMS_Id__c;  
        c.PreferredAddress=add.Preferred_Flag__c;
        c.SfdcAddressID=add.Id;
        c.State=add.State_Name__c;
        c.status=add.StatusCode__c;
        c.StreetAddress=add.Street__c;
        c.ZipCode=add.Zipcode__c;
        c.ZipCodeExtension=add.Zipcode_Extn__c;
                
        try
        {
        outputresult=s.AddContactAddress(c);
         system.debug('****'+outputresult);
        }
        catch(Exception ex)
          {
          system.debug('output from webservice: '+ex);       
    }
        }       
    } 
    
    @future (callout=true)
  public static void UpdateContactAddress(set<Id> addset) {
          string outputresult;
          List<Contact_Address__c> addList = new List<Contact_Address__c>([select Id,Name_Id__c,Contact_PIMS_Id__c,Address_Type_Code__c,Preferred_Flag__c,County_Name__c,State_Name__c,Country_Name__c,City__c,Street__c,Address_Line1__c,Address_Line2__c,Zipcode__c,Zipcode_Extn__c,Comments__c,StatusCode__c from Contact_Address__c where ID In: addset]); 
          
          WebServiceFinal4.BasicEndpoint s = new WebServiceFinal4.BasicEndpoint();
          for(Contact_Address__c add: addList){
           system.debug('updated address: '+add.Country_Name__c);     
          //Stores address details in AddressWrapper
                WebServiceFinal2.AddressWrapper c=new WebServiceFinal2.AddressWrapper();
                c.AddressLine1=add.Address_Line1__c;
                c.AddressLine2=add.Address_Line2__c;
                c.AddressType=add.Address_Type_Code__c;
                c.City=add.City__c;
                c.Comments=add.Comments__c;
                c.Country=add.Country_Name__c;
                c.County=add.County_Name__c;
                c.DataOn=system.DateTime.Now();
                if(add.Name_Id__c!=null){
                c.NameID = Integer.Valueof(add.Name_Id__c);}  
                c.PartnerContactID=add.Contact_PIMS_Id__c;    
                c.PreferredAddress=add.Preferred_Flag__c;
                c.SfdcAddressID= add.Id;
                c.State=add.State_Name__c;
                c.status=add.StatusCode__c;
                c.StreetAddress=add.Street__c;
                c.ZipCode=add.Zipcode__c;
                c.ZipCodeExtension=add.Zipcode_Extn__c;
                
        try
        {
                 outputresult=s.UpdateContactAddress(c);
                 system.debug('****'+outputresult);
        }
        catch(Exception ex)
          {
                system.debug('output from webservice: '+ex);       
          }
        }       
    } 
}